# 编写一个程序，它读取这个文件，并内容打印三次:
# 第一次打印时读取整个文件
# 第二次打印时遍历文件对象
# 第三次打印时将各行存储在一个列表中，再在with代码块外打印它们

print("The first time:")
with open('pi_digits.txt') as file_object:
    content = file_object.read()
print(content.rstrip())

print("\nThe second time:")
with open('pi_digits.txt') as file_object:
    for line in file_object:
        print(line.rstrip())

print("\nThe third time:")
with open('pi_digits.txt') as file_object:
    lines = file_object.readlines()

for line in lines:
    print(line.rstrip())
